package com.treasure.mall.biz.repository.user;

import com.treasure.mall.biz.base.JpaSearchableRepository;
import com.treasure.mall.biz.entity.user.WechatUser;
import org.springframework.stereotype.Repository;

/**
 *
 * +---------------------------------------------------------
 * * @package: com.treasure.mall.biz.repository.user
 * * @author: guomw (guomwchen@foxmail.com)
 * * @date: 2020/6/11 10:38
 * * @since: V1.0.0
 * +---------------------------------------------------------
 * 注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的
 * Copyright 2019-2022 com.treasure.mall.biz.repository.user Inc. All rights reserved.
 */
@Repository
public interface WechatUserRepository extends JpaSearchableRepository<WechatUser, Long> {

    /**
     * 根据用户OpenID获取微信用户信息
     *
     * @param appId
     * @param openId
     * @return
     */
    WechatUser findFirstByAppIdAndOpenId(String appId, String openId);


    WechatUser findFirstByUnionId(String unionId);

    /**
     * 根据用户手机
     *
     * @param appId
     * @param phoneNumber
     * @return
     */
    WechatUser findFirstByAppIdAndPhoneNumber(String appId, String phoneNumber);

    /**
     * 手机查找
     *
     * @param phoneNumber
     * @return
     */
    WechatUser findTopByPhoneNumber(String phoneNumber);

}
